<?php
// prefix use sub
$upLockFile = DT_CACHE. '/update.lock';
if (!file_exists($upLockFile)){
	touch($upLockFile);
}

// oneday to refresh
if ($DT_TIME - filemtime($upLockFile) > 86400) {
	//		do update
	foreach($MODULE as $k => $v) {
		if ($v['isupdate']) {
			$upTable = $db->getPre() . $v['module'];
			$sqlin  = "select itemid from {$upTable} where addtime<".(time()-86400*35)." LIMIT 20";
			$items = $db->getCol($sqlin, 'itemid');
			if ($items) {
				$sql = "update {$upTable} set  addtime = addtime+".(86400*30). " where itemid in (".implode(',', $items).")";
				$db->query($sql);
			}
		}
	}
}
